//
//  KKVideo1Cell.m
//  DoMi
//
//  Created by 康凯 on 2016/11/10.
//  Copyright © 2016年 kk. All rights reserved.
//

#import "KKVideo1Cell.h"

@implementation KKVideo1Cell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.shadowView.layer.shadowOffset=CGSizeMake(0, 0);
    self.shadowView.layer.shadowOpacity=0.8;
    self.shadowView.layer.shadowColor=[UIColor grayColor].CGColor;
    
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

#pragma mark 初始化数据
-(void)initData:(KKStudyList *)data{
    [self.avater sd_setImageWithURL:[NSURL URLWithString:data.cover] placeholderImage:[UIImage imageNamed:@"default_avater"]];
    self.title.text=data.videoname;
    self.speaker.text=data.speaker;
    self.desc.text=data.videodesc;
}
#pragma mark 初始化文章数据
-(void)initArticleData:(KKRelateArticleM *)data{
    [self.avater sd_setImageWithURL:[NSURL URLWithString:data.avatar] placeholderImage:[UIImage imageNamed:@"default_avater"]];
    self.title.text=data.title;
    self.speaker.text=data.nickname;
    self.desc.text=data.content;
}

-(void)initRankData:(KKStudyList *)data{
    [self.avater sd_setImageWithURL:[NSURL URLWithString:data.cover] placeholderImage:[UIImage imageNamed:@"default_avater"]];
    self.title.text=data.videoname;
    self.desc.text=data.videodesc;
    if([data.play isEqualToString:@"0"]){
        self.playCount.text=@"";
    }else{
        self.playCount.text=[NSString stringWithFormat:@"浏览%@",data.play];
    }
    int rank=[data.rowno intValue];
    if([KKAppUtils isEmptyString:data.nickname]){
        self.speaker.text=@"匿名";
    }else{
        self.speaker.text=data.nickname;
    }
    if(rank<6){
        [self.rankImg setImage:[UIImage imageNamed:[NSString stringWithFormat:@"rank%d",rank]]];
    }
}

-(void)initArticleRankData:(KKStudyList *)data{
    [self.avater sd_setImageWithURL:[NSURL URLWithString:data.avatar] placeholderImage:[UIImage imageNamed:@"default_avater"]];
    self.title.text=data.title;
    self.desc.text=data.content;
    if([data.click isEqualToString:@"0"]){
        self.playCount.text=@"";
    }else{
        self.playCount.text=[NSString stringWithFormat:@"浏览%@",data.click];
    }
    int rank=[data.rowno intValue];
    if([KKAppUtils isEmptyString:data.nickname]){
        self.speaker.text=@"匿名";
    }else{
        self.speaker.text=data.nickname;
    }
    if(rank<6){
        [self.rankImg setImage:[UIImage imageNamed:[NSString stringWithFormat:@"rank%d",rank]]];
    }
}

-(void)initRankExpertData:(KKStudyList *)data{
    [self.avater sd_setImageWithURL:[NSURL URLWithString:data.avatar] placeholderImage:[UIImage imageNamed:@"default_avater"]];
    self.title.text=data.company;
    self.desc.text=data.industry;
    if([data.click isEqualToString:@"0"]){
        self.playCount.text=@"";
    }else{
        self.playCount.text=[NSString stringWithFormat:@"咨询%@",data.click];
    }
    int rank=[data.rowno intValue];
    if([KKAppUtils isEmptyString:data.realname]){
        self.speaker.text=@"匿名";
    }else{
        self.speaker.text=data.realname;
    }
    if(rank<6){
        [self.rankImg setImage:[UIImage imageNamed:[NSString stringWithFormat:@"rank%d",rank]]];
    }
}
-(void)initOtherData:(KKStudyList *)data{
    [self.avater sd_setImageWithURL:[NSURL URLWithString:data.avatar] placeholderImage:[UIImage imageNamed:@"default_avater"]];
    self.title.text=data.company;
    self.desc.text=data.industry;
    if([data.click isEqualToString:@"0"]){
        self.playCount.text=@"";
    }else{
        self.playCount.text=[NSString stringWithFormat:@"积分%@",data.click];
    }
    int rank=[data.rowno intValue];
    if([KKAppUtils isEmptyString:data.realname]){
        self.speaker.text=@"匿名";
    }else{
        self.speaker.text=data.realname;
    }
    if(rank<6){
        [self.rankImg setImage:[UIImage imageNamed:[NSString stringWithFormat:@"rank%d",rank]]];
    }
}

-(void)initSearchData:(KKSearchM *)data{
    self.title.text=data.title;
    self.desc.text=data.context;
    if([KKAppUtils isEmptyString:data.nickname]){
        self.speaker.text=@"匿名";
    }else{
        self.speaker.text=data.nickname;
    }
}
@end
